package com.xnx3.banmahuishou.superadmin.controller;

import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.xnx3.banmahuishou.core.entity.WanggeSettime;
import com.xnx3.j2ee.service.SqlService;
import com.xnx3.j2ee.util.ActionLogUtil;
import com.xnx3.j2ee.util.Page;
import com.xnx3.j2ee.util.Sql;

/**
 * 系统管理
 * @author 王晓龙
 */
@Controller(value="BanmahuishouSuperadminWanggeSettimeController")
@RequestMapping("/superadmin/wanggesettime/")
public class WanggeSettimeController extends BaseController {
	@Resource
	private SqlService sqlService;

	/**
	 * 营业时间列表
	 */
	@RequestMapping("list${url.suffix}")
	public String list(HttpServletRequest request,Model model){
		Sql sql = new Sql(request);
		sql.setSearchColumn(new String[]{"dailishang_username"});
		int count = sqlService.count("laji_wangge_settime", sql.getWhere());
		Page page = new Page(count, 15, request);
		sql.setSelectFromAndPage("SELECT * FROM laji_wangge_settime", page);
		sql.setDefaultOrderBy("laji_wangge_settime.id DESC");
		List<WanggeSettime> list = sqlService.findBySql(sql, WanggeSettime.class);
		
		ActionLogUtil.insert(request, "系统管理", "第"+page.getCurrentPageNumber()+"页");
		
		model.addAttribute("page", page);
		model.addAttribute("list", list);
		return "/superadmin/wanggesettime/list";
	}
}
